package fdd.sys.hbm;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class UsersManager {
	public static void main(String[] args) {
		
	}
	public void doSth(){
		try{
			Configuration conf = new Configuration().configure();
			System.out.println(conf);
			SessionFactory sf = conf.buildSessionFactory();
			Session sess = sf.openSession();
			Transaction tx = sess.beginTransaction();
			Users u = new Users();
			u.setUser_id("0004");
			u.setUser_code("from_hibernate");
			u.setUser_name("test_hibernate");
			u.setIs_valied(12781001);
			sess.save(u);
			System.out.println(u);
			tx.commit();
			sess.close();
		}catch(Exception e){e.printStackTrace();}
	}
}
